import { AxiosRequestConfig, AxiosResponse } from "axios";
import { IId } from "../interfaces";

export interface IHttpserverOption<T = any>{
  successRequestInterceptor?:(config:AxiosRequestConfig) => any
  failtRequestInterceptor?:(error:Error) => any
  successResponseInterceptor?:(respoinse:AxiosResponse<T>) => any
  FailResponseInterceptor?:(error:Error) => any
}

export interface IHttpServer{
  get<T = any>(url:string, query?:object):Promise<T>
  post<T = any>(url:string, body?:any):Promise<T>
  put<T = any>(url:string, body?:any):Promise<T>
  delete<T = any>(url:string, body?:any):Promise<T>

  getResource<T = any>(resourceName:string, resourceId:string, query?:object):Promise<T>
  getResources<T = any>(resourceName:string, query?:object):Promise<T>
  createResource<T = any>(resourceName:string, resource:IId):Promise<T>
  replaceResource<T = any>(resourceName:string, resource:IId):Promise<T>
  deleteResource<T = any>(resourceName:string, resource:IId):Promise<T>
}
